/**
 * Created by francis on 2017/12/11.
 * 交通工具枚举
 */
public enum TransportationsEnum {
    UNKNOWN(0, "未知"),
    CAR(1, "小汽车"),
    BUS(2, "巴士"),
    TRAIN(3, "地铁");
    private int val;
    private String name;

    TransportationsEnum(int val, String name) {
        this.val = val;
        this.name = name;
    }

    public static TransportationsEnum getByVal(int val) {
        for (TransportationsEnum item : values()) {
            if (item.getVal() == val) {
                return item;
            }
        }
        return TransportationsEnum.UNKNOWN;
    }

    public int getVal() {
        return val;
    }

    public String getName() {
        return name;
    }
}
